
<template>
		<view>
			<uni-popup ref="popup" type="center" class="poster-alert">
				<view class="poster"><image :src="poster" @longpress="saveImg"></image></view>
				<view class="hm row-center">
					<view class="item" @tap="shareWx">
						<button open-type="share" class="sharebtn">
							<!-- <image :src="util.ossimg('button-wechat.png')"></image> -->
							<image class="image" src="../../static/fx_wx@2x.png" mode=""></image>
						</button>
					</view>					
					<!-- #ifdef MP-WEIXIN -->
					<view class="item" @tap="saveImg">
						<!-- <view class="sharebtn"><image :src="util.ossimg('button-save.png')"></image></view> -->
						<image class="image" src="../../static/fx_bd@2x.png" mode=""></image>
					</view>
					<!-- #endif -->
				</view>			
		 </uni-popup>
	 </view>
</template>
 
<script>
	export default{
		name:'GoodsPoster', //商品分享海报	
		data(){
			return{
				poster:'',
			}
		},
		methods:{
			 show(){
				//this.$refs.popup.open();
			 },
			 close(){
				//this.$refs.popup.close();
			 },
			 //分享微信好友
			 shareWx(){
				 
			 },
			 //保存图片
			 async saveImg(){
				 // #ifdef MP-WEIXIN
				 let that = this;
				 let imginfo = await uni.getImageInfo({src: that.poster })
				 if(imginfo[1]){
					uni.saveImageToPhotosAlbum({filePath:imginfo[1].path,
						success() { that.tips.toast('保存成功') },
						fail(rej){  that.tips.toast('保存失败'); }
					})
				 }
				 // #endif				 
			 },
			 
		}		
	}
</script>
 
<style lang="scss" scoped>
	.poster-alert{ width:620rpx;
		.poster{ width:620rpx; height:832rpx; overflow: hidden; background:#fff; border-radius:16rpx;}
		.hm{ margin-top:60rpx; 
			.item{ text-align: center; margin:0 60rpx;
				.sharebtn{ background:none; border:0; padding:0; width:100rpx; height:100rpx; margin:0 auto; margin-bottom:12rpx;
					&:after{display:none;}
					image{ width:100rpx; height:100rpx; display:block; }					
				}
				text{ font-size:24rpx; color:#fff;}
			}
		}
	}	
	.image{
		width: 104rpx;
		height: 104rpx;
	}
</style>